package com.yang.demo.common;

import com.alibaba.fastjson.JSON;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Map;

@SpringBootApplication
public class CommonApplication {

//    public static void main(String[] args) {
//        SpringApplication.run(CommonApplication.class, args);
//    }

    public static void main(String[] args) {
        String  json = "{\n" +
                "    \"msg\": \"执行成功\", \n" +
                "    \"code\": 1000, \n" +
                "    \"domain\": {\n" +
                "        \"id\": \"4e6a30f16dad4126b27721d681ca9983\", \n" +
                "        \"keyword\": \"网址续费2\", \n" +
                "        \"proType\": {\n" +
                "            \"text\": \"域名\", \n" +
                "            \"value\": \"domain\"\n" +
                "        }, \n" +
                "        \"registrarId\": \"yzz2\", \n" +
                "        \"registrantId\": \"1226abc126\", \n" +
                "        \"regDate\": \"2016-12-21 15:30:56\", \n" +
                "        \"expireDate\": \"2021-12-20 15:30:57\", \n" +
                "        \"proStatus\": {\n" +
                "            \"wlk\": \"pendingDelete\", \n" +
                "            \"text\": \"保留期\", \n" +
                "            \"kw\": \"D\", \n" +
                "            \"value\": \"PENDING_DELETE\"\n" +
                "        }, \n" +
                "        \"auditStatus\": {\n" +
                "            \"wlk\": \"passed\", \n" +
                "            \"text\": \"通过\", \n" +
                "            \"kw\": \"pass\", \n" +
                "            \"value\": \"PASS\"\n" +
                "        }, \n" +
                "        \"createDate\": \"2016-12-21 15:30:56\", \n" +
                "        \"updateDate\": \"2016-12-21 15:30:56\", \n" +
                "        \"transPassword\": \"uj9hucbd\", \n" +
                "        \"password\": \"111111\", \n" +
                "        \"agentPassword\": \"ut8nb2kv\"\n" +
                "    }, \n" +
                "    \"eppStatus\": [\n" +
                "        {\n" +
                "            \"status\": \"ok\", \n" +
                "            \"lang\": \"en\"\n" +
                "        }\n" +
                "    ], \n" +
                "    \"registrant\": {\n" +
                "        \"registrantId\": \"1226abc126\", \n" +
                "        \"registrarId\": \"ooxx\", \n" +
                "        \"password\": \"123456789\", \n" +
                "        \"contactName\": \"王晓晓\", \n" +
                "        \"address\": \"知春路紫金数码园4号楼201\", \n" +
                "        \"email\": \"wangshanlin@knet.cn\", \n" +
                "        \"internalCode\": \"86\", \n" +
                "        \"province\": \"北京\", \n" +
                "        \"city\": \"海淀区\", \n" +
                "        \"mobile\": \"17090436091\", \n" +
                "        \"telephone\": \"01087120761\", \n" +
                "        \"fax\": \"01089768989\", \n" +
                "        \"postalModel\": \"loc\", \n" +
                "        \"zipcode\": \"100190\", \n" +
                "        \"registrantType\": {\n" +
                "            \"text\": \"个人\", \n" +
                "            \"value\": \"I\"\n" +
                "        }, \n" +
                "        \"idType\": {\n" +
                "            \"text\": \"军官证\", \n" +
                "            \"value\": \"I2\"\n" +
                "        }, \n" +
                "        \"idNumber\": \"123456789\", \n" +
                "        \"createDate\": \"2016-12-26 16:58:25\", \n" +
                "        \"updateDate\": \"2017-01-11 10:17:46\", \n" +
                "        \"telephoneIntl\": \"86\", \n" +
                "        \"faxIntl\": \"86\", \n" +
                "        \"domainRegistrantId\": \"wz_1226abc126\", \n" +
                "        \"telephoneExt\": \"1234\", \n" +
                "        \"faxExt\": \"1234\", \n" +
                "        \"mobileIntl\": \"86\", \n" +
                "        \"organization\": \"测试测试测试\", \n" +
                "        \"auditFile\": \"http://xxx/image/group1/M00/05/F7/wKj5L1hTn1SAUYfdAAFSy2tt0tw999.jpg\", \n" +
                "        \"status\": {\n" +
                "            \"text\": \"重新审核\", \n" +
                "            \"value\": \"REAUDIT\"\n" +
                "        }, \n" +
                "        \"otherFile1\": \"http://xxx/image/group1/M00/05/F7/wKj5L1hTn1SAUYfdAAFSy2tt0tw999.jpg\", \n" +
                "        \"otherFile2\": \"http://xxx/image/group1/M00/05/F7/wKj5L1hTn1SAUYfdAAFSy2tt0tw999.jpg\", \n" +
                "        \"otherFile3\": \"http://xxx/image/group1/M00/05/F7/wKj5L1hTn1SAUYfdAAFSy2tt0tw999.jpg\", \n" +
                "        \"otherFile4\": \"http://xxx/image/group1/M00/05/F7/wKj5L1hTn1SAUYfdAAFSy2tt0tw999.jpg\"\n" +
                "    }, \n" +
                "    \"otherStatus\": null\n" +
                "}";
        Map map = getObject(json);
        Map status = (Map) getObject(map.get("domain")).get("auditStatus");
        System.out.println(status.get("value").toString().toLowerCase());
        System.out.println(status);



        String json1 = "{\n" +
                "    \"msg\": \"执行成功\", \n" +
                "    \"code\": 1000, \n" +
                "    \"data\": {\n" +
                "        \"registrantId\": \"1216yonghu2\", \n" +
                "        \"registrarId\": \"ooxx\", \n" +
                "        \"password\": \"abc123\", \n" +
                "        \"contactName\": \"黄音\", \n" +
                "        \"address\": \"知春路\", \n" +
                "        \"email\": \"huangyin4@knet.cn\", \n" +
                "        \"internalCode\": \"cn\", \n" +
                "        \"province\": \"北京\", \n" +
                "        \"city\": \"东城区\", \n" +
                "        \"mobile\": \"15011557467\", \n" +
                "        \"telephone\": \"01087120766\", \n" +
                "        \"postalModel\": \"loc\", \n" +
                "        \"zipcode\": \"100186\", \n" +
                "        \"registrantType\": {\n" +
                "            \"text\": \"个人\", \n" +
                "            \"value\": \"I\"\n" +
                "        }, \n" +
                "        \"idType\": {\n" +
                "            \"text\": \"身份证\", \n" +
                "            \"value\": \"I1\"\n" +
                "        }, \n" +
                "        \"idNumber\": \"420325198607130628\", \n" +
                "        \"createDate\": \"2016-12-16 16:00:17\", \n" +
                "        \"updateDate\": \"2016-12-19 13:57:18\", \n" +
                "        \"telephoneIntl\": \"86\", \n" +
                "        \"faxIntl\": \"86\", \n" +
                "        \"domainRegistrantId\": \"wz_1216yonghu2\", \n" +
                "        \"mobileIntl\": \"86\", \n" +
                "        \"auditFile\": \"http://xxx/M00/05/F7/wKj5LVhTnw6AGFVaAALhYDtSO7U938.jpg\", \n" +
                "        \"status\": {\n" +
                "            \"text\": \"通过\", \n" +
                "            \"value\": \"PASS\"\n" +
                "        }, \n" +
                "        \"remark\": \"通过\", \n" +
                "        \"otherFile1\": \"http://xxx/M00/05/F7/wKj5L1hTnwaAAltXAAD_QXF_AE8099.jpg\"\n" +
                "    }\n" +
                "}";
        Map map1 = getObject(json1);
        Map r_status = (Map)getObject(getObject(map1.get("data")).get("status"));
        System.out.println(r_status);
        System.out.println(r_status.get("value").toString().toLowerCase());
        System.out.println(r_status.get("text"));
        System.out.println(map1.get("code"));


    }
    static Map getObject(Object s){
        return JSON.parseObject(s.toString(), Map.class);
    }
}

